|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectfurny.furndb.FurnCache
public final class FurnCache
Simple cache that requests all furnitures from the database and stores them
in a map. If a furniture is updated or deleted, the cache is refreshed.
This class is a SINGLETON.
Field Summary | |
---|---|
private FurnDBManager |
dbManager
|
private java.util.Map<java.lang.Long,Furniture> |
furnitures
|
private static FurnCache |
INSTANCE
|
Constructor Summary | |
---|---|
private |
FurnCache()
Private constructor for single instance. |
Method Summary | |
---|---|
void |
furnitureDeleted(java.lang.Long id)
This method will be notified if a furniture is updated. |
void |
furnitureIdsUpdated(java.util.List<java.lang.Long> ids)
This method will be notified if a list of furnitures are updated. |
void |
furnitureUpdated(java.lang.Long id,
Furniture furniture)
This method will be notified if a furniture is updated. |
java.util.List<Furniture> |
getAllFurnitures()
Getter for a list of a cached furnitures. |
Furniture |
getFurniture(java.lang.Long id)
Getter for a furniture. |
static FurnCache |
getInstance()
Getter for the single instance. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static final FurnCache INSTANCE
private final java.util.Map<java.lang.Long,Furniture> furnitures
private final FurnDBManager dbManager
Constructor Detail |
---|
private FurnCache()
Method Detail |
---|
public static FurnCache getInstance()
public void furnitureUpdated(java.lang.Long id, Furniture furniture)
FurnitureUpdateListener
furnitureUpdated
in interface FurnitureUpdateListener
id
- The id of the furniture.furniture
- The furniturepublic void furnitureIdsUpdated(java.util.List<java.lang.Long> ids)
FurnitureUpdateListener
furnitureIdsUpdated
in interface FurnitureUpdateListener
ids
- The list of furniture ids.public void furnitureDeleted(java.lang.Long id)
FurnitureUpdateListener
furnitureDeleted
in interface FurnitureUpdateListener
id
- The id of the furniture.public java.util.List<Furniture> getAllFurnitures()
public Furniture getFurniture(java.lang.Long id)
id
- The id of the furniture.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |